﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class InfoPanelController : MonoBehaviour {

	public MainGameController controller;

	void Start(){

		Button btn = GetComponent<Button> ();
		btn.onClick.AddListener (delegate() {
			this.OnClick();	
		});

	}

	public void Open(){

		string msg = SenceProp.InfoMessage;

		if (msg.Length > 24) {
			msg = msg.Substring (0, 24) + "...";
		}

		UIUtility.FindChild (this.gameObject, "Text").GetComponent<Text> ().text = msg;

		UIUtility.Show (this.gameObject);
	}

	public void Close(){
		UIUtility.Hide (this.gameObject);
	}


	public void OnClick() {
		controller.ShowPushMessage ();
		UIUtility.Hide (this.gameObject);
	}





}
